package cn.hallele.bbts.crawler.dao.entity;

import cn.hallele.bbts.crawler.common.enums.LotteryTypeEnum;
import jakarta.persistence.*;
import lombok.*;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 每一期彩票数据
 *
 * @author anle5
 * @since 2023/12/2 星期六 22:58
 */
@Data
@Entity
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "cc_lottery_data")
public class LotteryDataEntity implements Serializable {
    @Serial
    private static final long serialVersionUID = 4218596739403551805L;

    /**
     * 身份唯一标识
     * 生成策略: 从表y_generator中读取
     * name: TableGenerator唯一标识
     * pkColumnName：生成策略所对应键值的名称
     * pkColumnValue：键当前所生成的值，它的值将会随着每次创建累加
     * initialValue: 初始值
     * allocationSize: 递增至
     */
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "IdentityEntity")
    @TableGenerator(name = "IdentityEntity",
            table = "key_generator",
            pkColumnName = "gen_name",
            valueColumnName = "gen_value",
            pkColumnValue = "cc_lottery_data",
            initialValue = 1,
            allocationSize = 1
    )
    private Long id;

    /**
     * 期号
     */
    private String issueId;

    /**
     * 彩票类型
     */
    @Enumerated(EnumType.STRING)
    private LotteryTypeEnum lotteryType;

    /**
     * 开奖日期
     */
    private LocalDateTime drawDate;

    /**
     * 中奖号码
     */
    private String winningNumbers;

    /**
     * 奖池金额
     */
    private Long totalAmount;

    /**
     * 销售金额
     */
    private Long salesAmount;

    /**
     * 数据创建时间
     */
    private LocalDateTime createTime;
}
